﻿<ResourceDictionary xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
                    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
                    xmlns:Microsoft_Windows_Themes="clr-namespace:Microsoft.Windows.Themes;assembly=PresentationFramework.Aero"
                    xmlns:ConvertersAndTemplateSelectors="clr-namespace:AutomationMLMapper.Controls.ConvertersAndTemplateSelectors">    
    <ConvertersAndTemplateSelectors:ItemCountExpanderConverter x:Key="icec"></ConvertersAndTemplateSelectors:ItemCountExpanderConverter>
    <ConvertersAndTemplateSelectors:BoolToVisibilityConverter x:Key="btvc" FalseValue="Collapsed"></ConvertersAndTemplateSelectors:BoolToVisibilityConverter>

    <Style x:Key="ColumnHeaderStyle" TargetType="{x:Type GridViewColumnHeader}">
        <Setter Property="HorizontalAlignment" Value="Stretch"></Setter>
        <Setter Property="VerticalAlignment" Value="Stretch"></Setter>
        <Setter Property="HorizontalContentAlignment" Value="Left"></Setter>
        <Setter Property="VerticalContentAlignment" Value="Center"></Setter>
    </Style>
    
    <ControlTemplate x:Key="ButtonBaseControlTemplate" TargetType="{x:Type ButtonBase}">

        <Microsoft_Windows_Themes:ButtonChrome x:Name="Chrome" 
				BorderBrush="{TemplateBinding BorderBrush}" 
				Background="{TemplateBinding Background}" 
				RenderMouseOver="{TemplateBinding IsMouseOver}" 
				RenderPressed="{TemplateBinding IsPressed}" 
				RenderDefaulted="{TemplateBinding Button.IsDefaulted}" 
				SnapsToDevicePixels="True">
            <ContentPresenter x:Name="contentPresenter" ContentTemplate="{TemplateBinding ContentTemplate}" 
					Content="{TemplateBinding Content}" 
					ContentStringFormat="{TemplateBinding ContentStringFormat}" 
					HorizontalAlignment="{TemplateBinding HorizontalContentAlignment}" 
					Margin="{TemplateBinding Padding}" RecognizesAccessKey="True" 
					SnapsToDevicePixels="{TemplateBinding SnapsToDevicePixels}" 
					VerticalAlignment="{TemplateBinding VerticalContentAlignment}"/>

        </Microsoft_Windows_Themes:ButtonChrome>

        <ControlTemplate.Triggers>
            <Trigger Property="IsKeyboardFocused" Value="True">
                <Setter Property="RenderDefaulted" TargetName="Chrome" Value="True"/>
            </Trigger>
            <Trigger Property="ToggleButton.IsChecked" Value="True">
                <Setter Property="RenderPressed" TargetName="Chrome" Value="True"/>
            </Trigger>
            <Trigger Property="IsEnabled" Value="False">
                <Setter Property="OpacityMask" TargetName="contentPresenter" Value="#FFE9E9E9"/>
                <Setter Property="Opacity" TargetName="contentPresenter" Value="0.30"/>
            </Trigger>
        </ControlTemplate.Triggers>
    </ControlTemplate>
    
   
    <Style x:Key="ExpanderRightHeaderStyle" TargetType="{x:Type ToggleButton}">
        <Setter Property="Template">
            <Setter.Value>
                <ControlTemplate TargetType="{x:Type ToggleButton}">
                    <Border Padding="{TemplateBinding Padding}">
                        <Grid Background="Transparent" SnapsToDevicePixels="False">
                            <Grid.RowDefinitions>
                                <RowDefinition Height="15"/>
                                <RowDefinition Height="*"/>
                            </Grid.RowDefinitions>
                            <Grid>
                                <Grid.LayoutTransform>
                                    <TransformGroup>
                                        <TransformGroup.Children>
                                            <TransformCollection>
                                                <RotateTransform Angle="-90"/>
                                            </TransformCollection>
                                        </TransformGroup.Children>
                                    </TransformGroup>
                                </Grid.LayoutTransform>
                                <Ellipse x:Name="circle" HorizontalAlignment="Center" Height="15" Stroke="DarkGray" VerticalAlignment="Center" Width="15" Fill="#FFFBFEFF"/>
                                <Path x:Name="arrow" Data="M 1,1.5 L 4.5,5 L 8,1.5" HorizontalAlignment="Center" 
                                      SnapsToDevicePixels="false" Stroke="#666" StrokeThickness="2" VerticalAlignment="Center"/>
                            </Grid>
                            <ContentPresenter HorizontalAlignment="Center" Margin="0,4,0,0" Grid.Row="1" RecognizesAccessKey="True" 
                                              SnapsToDevicePixels="True" VerticalAlignment="Top"/>
                        </Grid>
                    </Border>
                    <ControlTemplate.Triggers>
                        <Trigger Property="IsChecked" Value="true">
                            <Setter Property="Data" TargetName="arrow" Value="M 1,4.5  L 4.5,1  L 8,4.5"/>
                        </Trigger>
                        <Trigger Property="IsMouseOver" Value="true">
                            <Setter Property="Stroke" TargetName="circle" Value="#FF3C7FB1"/>
                            <Setter Property="Stroke" TargetName="arrow" Value="#222"/>
                        </Trigger>
                        <Trigger Property="IsPressed" Value="true">
                            <Setter Property="Stroke" TargetName="circle" Value="#FF526C7B"/>
                            <Setter Property="StrokeThickness" TargetName="circle" Value="1.5"/>
                            <Setter Property="Stroke" TargetName="arrow" Value="#FF003366"/>
                        </Trigger>                        
                    </ControlTemplate.Triggers>
                    
                    
                </ControlTemplate>
            </Setter.Value>
        </Setter>
    </Style>
    
    <Style x:Key="ExpanderUpHeaderStyle" TargetType="{x:Type ToggleButton}">
        <Setter Property="Template">
            <Setter.Value>
                <ControlTemplate TargetType="{x:Type ToggleButton}">
                    <Border Padding="{TemplateBinding Padding}">
                        <Grid Background="Transparent" SnapsToDevicePixels="False">
                            <Grid.ColumnDefinitions>
                                <ColumnDefinition Width="15"/>
                                <ColumnDefinition Width="*"/>
                            </Grid.ColumnDefinitions>
                            <Grid>
                                <Grid.LayoutTransform>
                                    <TransformGroup>
                                        <TransformGroup.Children>
                                            <TransformCollection>
                                                <RotateTransform Angle="180"/>
                                            </TransformCollection>
                                        </TransformGroup.Children>
                                    </TransformGroup>
                                </Grid.LayoutTransform>
                                <Ellipse x:Name="circle" HorizontalAlignment="Center" Height="15" Stroke="DarkGray" VerticalAlignment="Center" Width="15" Fill="#FFFBFEFF"/>
                                <Path x:Name="arrow" Data="M 1,1.5 L 4.5,5 L 8,1.5" HorizontalAlignment="Center" SnapsToDevicePixels="false" 
                                      Stroke="#666" StrokeThickness="2" VerticalAlignment="Center"/>
                            </Grid>
                            <ContentPresenter Grid.Column="1" HorizontalAlignment="Stretch" Margin="4,0,0,0" 
                                              RecognizesAccessKey="True" SnapsToDevicePixels="True" VerticalAlignment="Center"/>
                        </Grid>
                    </Border>
                    <ControlTemplate.Triggers>
                        <Trigger Property="IsChecked" Value="true">
                            <Setter Property="Data" TargetName="arrow" Value="M 1,4.5  L 4.5,1  L 8,4.5"/>
                        </Trigger>
                        <Trigger Property="IsMouseOver" Value="true">
                            <Setter Property="Stroke" TargetName="circle" Value="#FF3C7FB1"/>
                            <Setter Property="Stroke" TargetName="arrow" Value="#222"/>
                        </Trigger>
                        <Trigger Property="IsPressed" Value="true">
                            <Setter Property="Stroke" TargetName="circle" Value="#FF526C7B"/>
                            <Setter Property="StrokeThickness" TargetName="circle" Value="1.5"/>
                            <Setter Property="Stroke" TargetName="arrow" Value="#FF003366"/>
                        </Trigger>
                    </ControlTemplate.Triggers>
                </ControlTemplate>
            </Setter.Value>
        </Setter>
    </Style>
    
    <Style x:Key="ExpanderLeftHeaderStyle" TargetType="{x:Type ToggleButton}">
        <Setter Property="Template">
            <Setter.Value>
                <ControlTemplate TargetType="{x:Type ToggleButton}">
                    <Border Padding="{TemplateBinding Padding}">
                        <Grid Background="Transparent" SnapsToDevicePixels="False">
                            <Grid.RowDefinitions>
                                <RowDefinition Height="15"/>
                                <RowDefinition Height="*"/>
                            </Grid.RowDefinitions>
                            <Grid>
                                <Grid.LayoutTransform>
                                    <TransformGroup>
                                        <TransformGroup.Children>
                                            <TransformCollection>
                                                <RotateTransform Angle="90"/>
                                            </TransformCollection>
                                        </TransformGroup.Children>
                                    </TransformGroup>
                                </Grid.LayoutTransform>
                                <Ellipse x:Name="circle" HorizontalAlignment="Center" Height="15" Stroke="DarkGray" VerticalAlignment="Center" Width="15" Fill="#FFFBFEFF"/>
                                <Path x:Name="arrow1" Data="M 1,1.5 L 4.5,5 L 8,1.5" HorizontalAlignment="Center" SnapsToDevicePixels="false" 
                                      Stroke="#FF353535" StrokeThickness="1" VerticalAlignment="Center" Margin="0,0,0,3"/>
                                <Path x:Name="arrow2" Data="M 1,1.5 L 4.5,5 L 8,1.5" HorizontalAlignment="Center" SnapsToDevicePixels="false" 
                                      Stroke="#FF353535" StrokeThickness="1" VerticalAlignment="Center" Margin="0,3,0,0"/>
                            </Grid>
                            <ContentPresenter HorizontalAlignment="Center" Margin="0,4,0,0" Grid.Row="1" RecognizesAccessKey="True" 
                                              SnapsToDevicePixels="True" VerticalAlignment="Top"/>
                        </Grid>
                    </Border>
                    <ControlTemplate.Triggers>
                        <Trigger Property="IsChecked" Value="true">
                            <Setter Property="Data" TargetName="arrow1" Value="M 1,4.5  L 4.5,1  L 8,4.5"/>
                            <Setter Property="Data" TargetName="arrow2" Value="M 1,4.5  L 4.5,1  L 8,4.5"/>
                        </Trigger>
                        <Trigger Property="IsMouseOver" Value="true">
                            <Setter Property="Stroke" TargetName="circle" Value="#FF3C7FB1"/>
                        </Trigger>
                        <Trigger Property="IsPressed" Value="true">
                            <Setter Property="Stroke" TargetName="circle" Value="#FF526C7B"/>
                            <Setter Property="StrokeThickness" TargetName="circle" Value="1.5"/>
                        </Trigger>
                    </ControlTemplate.Triggers>
                </ControlTemplate>
            </Setter.Value>
        </Setter>
    </Style>
    
    <Style x:Key="ExpanderHeaderFocusVisual">
        <Setter Property="Control.Template">
            <Setter.Value>
                <ControlTemplate>
                    <Border>
                        <Rectangle Margin="0" SnapsToDevicePixels="true" Stroke="Black" StrokeThickness="1" StrokeDashArray="1 2"/>
                    </Border>
                </ControlTemplate>
            </Setter.Value>
        </Setter>
    </Style>
    
    <Style x:Key="ExpanderDownHeaderStyle" TargetType="{x:Type ToggleButton}">
        <Setter Property="Template">
            <Setter.Value>
                <ControlTemplate TargetType="{x:Type ToggleButton}">
                    <Border Padding="{TemplateBinding Padding}">
                        <Grid Background="Transparent" SnapsToDevicePixels="False">
                            <Grid.ColumnDefinitions>
                                <ColumnDefinition Width="15"/>
                                <ColumnDefinition Width="*"/>
                            </Grid.ColumnDefinitions>
                            <Ellipse x:Name="circle" HorizontalAlignment="Center" Height="15" Stroke="DarkGray" VerticalAlignment="Center" Width="15" Fill="#FFFBFEFF"/>
                            <Path x:Name="arrow1" Data="M 1,1.5 L 4.5,5 L 8,1.5" HorizontalAlignment="Center" SnapsToDevicePixels="false" 
                                  Stroke="#FF353535" StrokeThickness="1" VerticalAlignment="Center" Margin="0,0,0,3"/>
                            <Path x:Name="arrow2" Data="M 1,1.5 L 4.5,5 L 8,1.5" HorizontalAlignment="Center" SnapsToDevicePixels="false" 
                                  Stroke="#FF353535" StrokeThickness="1" VerticalAlignment="Center" Margin="0,3,0,0"/>
                            <ContentPresenter Grid.Column="1" HorizontalAlignment="Stretch" Margin="4,0,0,0" RecognizesAccessKey="True" 
                                              SnapsToDevicePixels="True" VerticalAlignment="Center"/>
                        </Grid>
                    </Border>
                    <ControlTemplate.Triggers>
                        <Trigger Property="IsChecked" Value="true">
                            <Setter Property="Data" TargetName="arrow1" Value="M 1,4.5  L 4.5,1  L 8,4.5"/>
                            <Setter Property="Data" TargetName="arrow2" Value="M 1,4.5  L 4.5,1  L 8,4.5"/>
                        </Trigger>
                        <Trigger Property="IsMouseOver" Value="true">
                            <Setter Property="Stroke" TargetName="circle" Value="#FF3C7FB1"/>
                        </Trigger>
                        <Trigger Property="IsPressed" Value="true">
                            <Setter Property="Fill" TargetName="circle" Value="#FFC1EFFF"/>
                            <Setter Property="StrokeThickness" TargetName="circle" Value="1.5"/>
                        </Trigger>

                    </ControlTemplate.Triggers>
                </ControlTemplate>
            </Setter.Value>
        </Setter>
    </Style>
    
    <Style x:Key="ExpanderDownHeaderStyleWithItemCountVisualizuation" TargetType="{x:Type ToggleButton}">
        <Setter Property="Template">
            <Setter.Value>
                <ControlTemplate TargetType="{x:Type ToggleButton}">
                    <Border Padding="{TemplateBinding Padding}">
                        <Grid Background="Transparent" SnapsToDevicePixels="False">
                            <Grid.ColumnDefinitions>
                                <ColumnDefinition Width="15"/>
                                <ColumnDefinition Width="*"/>
                            </Grid.ColumnDefinitions>
                            <Ellipse x:Name="circle" HorizontalAlignment="Center" Height="15" Stroke="DarkGray" VerticalAlignment="Center" Width="15" Fill="#FFFBFEFF"/>
                            <Path x:Name="arrow1" Data="M 1,1.5 L 4.5,5 L 8,1.5" HorizontalAlignment="Center" SnapsToDevicePixels="false" 
                                  Stroke="#FF353535" StrokeThickness="1" VerticalAlignment="Center" Margin="0,0,0,3"/>
                            <Path x:Name="arrow2" Data="M 1,1.5 L 4.5,5 L 8,1.5" HorizontalAlignment="Center" SnapsToDevicePixels="false" 
                                  Stroke="#FF353535" StrokeThickness="1" VerticalAlignment="Center" Margin="0,3,0,0"/>
                            <ContentPresenter Grid.Column="1" HorizontalAlignment="Stretch" Margin="4,0,0,0" RecognizesAccessKey="True" 
                                              SnapsToDevicePixels="True" VerticalAlignment="Center"/>
                        </Grid>
                    </Border>
                    <ControlTemplate.Triggers>
                        <DataTrigger Binding="{Binding RelativeSource={RelativeSource Self}, 
                                     Path=DataContext.Elements.Count, Converter={StaticResource icec}, ConverterParameter=0}" Value="False">
                            <Setter Property="Fill" TargetName="circle" Value="LightGreen"/>
                            <Setter Property="ToolTip" TargetName="circle" Value="contains Elements"/>
                        </DataTrigger>
                        <Trigger Property="IsChecked" Value="true">
                            <Setter Property="Data" TargetName="arrow1" Value="M 1,4.5  L 4.5,1  L 8,4.5"/>
                            <Setter Property="Data" TargetName="arrow2" Value="M 1,4.5  L 4.5,1  L 8,4.5"/>
                            <Setter Property="Fill" TargetName="circle" Value="#FFFBFEFF"/>
                        </Trigger>
                        <Trigger Property="IsMouseOver" Value="true">
                            <Setter Property="Stroke" TargetName="circle" Value="#FF3C7FB1"/>
                        </Trigger>
                        <Trigger Property="IsPressed" Value="true">
                            <Setter Property="Fill" TargetName="circle" Value="#FFC1EFFF"/>
                            <Setter Property="StrokeThickness" TargetName="circle" Value="1.5"/>
                        </Trigger>
                    </ControlTemplate.Triggers>
                </ControlTemplate>
            </Setter.Value>
        </Setter>
    </Style>
    
    <Style x:Key="StretchedExpanderStyle" TargetType="{x:Type Expander}">
        <Setter Property="Foreground" Value="{DynamicResource {x:Static SystemColors.ControlTextBrushKey}}"/>
        <Setter Property="Background" Value="Transparent"/>
        <Setter Property="HorizontalContentAlignment" Value="Stretch"/>
        <Setter Property="VerticalContentAlignment" Value="Stretch"/>
        <Setter Property="BorderBrush" Value="Transparent"/>
        <Setter Property="BorderThickness" Value="1"/>
        <Setter Property="Template">
            <Setter.Value>
                <ControlTemplate TargetType="{x:Type Expander}">
                    <Border BorderBrush="{TemplateBinding BorderBrush}" BorderThickness="{TemplateBinding BorderThickness}" 
                            Background="{TemplateBinding Background}" CornerRadius="3" SnapsToDevicePixels="true">
                        <DockPanel>                            
                            <ToggleButton x:Name="HeaderSite" ContentTemplate="{TemplateBinding HeaderTemplate}" 
                                          ContentTemplateSelector="{TemplateBinding HeaderTemplateSelector}" 
                                          Content="{TemplateBinding Header}" DockPanel.Dock="Top" Foreground="{TemplateBinding Foreground}" 
                                          FontWeight="{TemplateBinding FontWeight}" FocusVisualStyle="{StaticResource ExpanderHeaderFocusVisual}"
                                          FontStyle="{TemplateBinding FontStyle}" FontStretch="{TemplateBinding FontStretch}" 
                                          FontSize="{TemplateBinding FontSize}" FontFamily="{TemplateBinding FontFamily}" 
                                          HorizontalContentAlignment="{TemplateBinding HorizontalContentAlignment}" 
                                          IsChecked="{Binding IsExpanded, Mode=TwoWay, RelativeSource={RelativeSource TemplatedParent}}" 
                                          Margin="1" MinWidth="0" MinHeight="0" Padding="{TemplateBinding Padding}" 
                                          Style="{StaticResource ExpanderDownHeaderStyleWithItemCountVisualizuation}"
                                          VerticalContentAlignment="{TemplateBinding VerticalContentAlignment}"/>
                            <ContentPresenter x:Name="ExpandSite" DockPanel.Dock="Bottom" Focusable="false" 
                                              HorizontalAlignment="{TemplateBinding HorizontalContentAlignment}" 
                                              Margin="{TemplateBinding Padding}" Visibility="Collapsed" 
                                              VerticalAlignment="{TemplateBinding VerticalContentAlignment}"/>
                        </DockPanel>
                    </Border>
                    <ControlTemplate.Triggers>
                        <Trigger Property="IsExpanded" Value="true">
                            <Setter Property="Visibility" TargetName="ExpandSite" Value="Visible"/>
                        </Trigger>
                        <Trigger Property="ExpandDirection" Value="Right">
                            <Setter Property="DockPanel.Dock" TargetName="ExpandSite" Value="Right"/>
                            <Setter Property="DockPanel.Dock" TargetName="HeaderSite" Value="Left"/>
                            <Setter Property="Style" TargetName="HeaderSite" Value="{StaticResource ExpanderRightHeaderStyle}"/>
                        </Trigger>
                        <Trigger Property="ExpandDirection" Value="Up">
                            <Setter Property="DockPanel.Dock" TargetName="ExpandSite" Value="Top"/>
                            <Setter Property="DockPanel.Dock" TargetName="HeaderSite" Value="Bottom"/>
                            <Setter Property="Style" TargetName="HeaderSite" Value="{StaticResource ExpanderUpHeaderStyle}"/>
                        </Trigger>
                        <Trigger Property="ExpandDirection" Value="Left">
                            <Setter Property="DockPanel.Dock" TargetName="ExpandSite" Value="Left"/>
                            <Setter Property="DockPanel.Dock" TargetName="HeaderSite" Value="Right"/>
                            <Setter Property="Style" TargetName="HeaderSite" Value="{StaticResource ExpanderLeftHeaderStyle}"/>
                        </Trigger>
                        <Trigger Property="IsEnabled" Value="false">
                            <Setter Property="Foreground" Value="{DynamicResource {x:Static SystemColors.GrayTextBrushKey}}"/>
                        </Trigger>

                    </ControlTemplate.Triggers>
                </ControlTemplate>
            </Setter.Value>
        </Setter>       
        
    </Style>
    
    <Style x:Key="StatusGroupExpander" TargetType="{x:Type Expander}">
        <Setter Property="Foreground" Value="{DynamicResource {x:Static SystemColors.ControlTextBrushKey}}"/>
        <Setter Property="Background" Value="Transparent"/>
        <Setter Property="HorizontalContentAlignment" Value="Stretch"/>
        <Setter Property="VerticalContentAlignment" Value="Stretch"/>
        <Setter Property="BorderBrush" Value="Transparent"/>
        <Setter Property="BorderThickness" Value="1"/>
        <Setter Property="Template">
            <Setter.Value>
                <ControlTemplate TargetType="{x:Type Expander}">
                    <Border BorderBrush="{TemplateBinding BorderBrush}" BorderThickness="{TemplateBinding BorderThickness}" 
                            Background="{TemplateBinding Background}" CornerRadius="3" SnapsToDevicePixels="true">
                        <DockPanel>
                            <ToggleButton x:Name="HeaderSite" ContentTemplate="{TemplateBinding HeaderTemplate}" 
                                          ContentTemplateSelector="{TemplateBinding HeaderTemplateSelector}" 
                                          Content="{TemplateBinding Header}" DockPanel.Dock="Top" Foreground="{TemplateBinding Foreground}" 
                                          FontWeight="{TemplateBinding FontWeight}" FocusVisualStyle="{StaticResource ExpanderHeaderFocusVisual}" 
                                          FontStyle="{TemplateBinding FontStyle}" FontStretch="{TemplateBinding FontStretch}" 
                                          FontSize="{TemplateBinding FontSize}" FontFamily="{TemplateBinding FontFamily}" 
                                          HorizontalContentAlignment="{TemplateBinding HorizontalContentAlignment}" 
                                          IsChecked="{Binding IsExpanded, Mode=TwoWay, RelativeSource={RelativeSource TemplatedParent}}" 
                                          Margin="1" MinWidth="0" MinHeight="0" Padding="{TemplateBinding Padding}"
                                          Style="{StaticResource ExpanderDownHeaderStyle}" VerticalContentAlignment="{TemplateBinding VerticalContentAlignment}"/>
                            <ContentPresenter x:Name="ExpandSite" DockPanel.Dock="Bottom" Focusable="false" 
                                              HorizontalAlignment="{TemplateBinding HorizontalContentAlignment}" 
                                              Margin="{TemplateBinding Padding}" Visibility="Collapsed" 
                                              VerticalAlignment="{TemplateBinding VerticalContentAlignment}"/>
                        </DockPanel>
                    </Border>
                    <ControlTemplate.Triggers>
                        <Trigger Property="IsExpanded" Value="true">
                            <Setter Property="Visibility" TargetName="ExpandSite" Value="Visible"/>
                        </Trigger>
                        <Trigger Property="IsEnabled" Value="false">
                            <Setter Property="Foreground" Value="{DynamicResource {x:Static SystemColors.GrayTextBrushKey}}"/>
                        </Trigger>
                    </ControlTemplate.Triggers>
                </ControlTemplate>
            </Setter.Value>
        </Setter>
    </Style>
    
    <Style x:Key="HeaderButtonStyle" TargetType="{x:Type Button}">
        <Setter Property="BorderBrush" Value="{x:Null}"></Setter>
        <Setter Property="Background" Value="Transparent"></Setter>
        <Setter Property="VerticalAlignment" Value="Top"></Setter>
        <Setter Property="HorizontalAlignment" Value="Right"></Setter> 
        <Setter Property="Height" Value="24"></Setter> 
        <Setter Property="Width" Value="24"></Setter>
        <Setter Property="Margin" Value="2,5,2,0"></Setter>
        <Setter Property="Template" Value="{DynamicResource ButtonBaseControlTemplate}"></Setter>
    </Style>

    <Style x:Key="HeaderToggleButtonStyle" TargetType="{x:Type ToggleButton}">
        <Setter Property="BorderBrush" Value="{x:Null}"></Setter>
        <Setter Property="Background" Value="Transparent"></Setter>
        <Setter Property="VerticalAlignment" Value="Top"></Setter>
        <Setter Property="HorizontalAlignment" Value="Right"></Setter>
        <Setter Property="Height" Value="24"></Setter>
        <Setter Property="Width" Value="24"></Setter>
        <Setter Property="Margin" Value="2,5,2,0"></Setter>
        <Setter Property="Template" Value="{DynamicResource ButtonBaseControlTemplate}"></Setter>
    </Style>
    
    <Style x:Key="LargeHeaderButtonStyle" TargetType="{x:Type Button}">
        <Setter Property="BorderBrush" Value="{x:Null}"></Setter>
        <Setter Property="Background" Value="Transparent"></Setter>
        <Setter Property="VerticalAlignment" Value="Center"></Setter>
        <Setter Property="HorizontalAlignment" Value="Right"></Setter>
        <Setter Property="Height" Value="32"></Setter>
        <Setter Property="Width" Value="32"></Setter>
        <Setter Property="Margin" Value="0,0,5,0"></Setter>
        <Setter Property="Template" Value="{DynamicResource ButtonBaseControlTemplate}"></Setter>
    </Style>
    
    <Style x:Key="ListItemBorderStyle" TargetType="{x:Type Border}">
        <Setter Property="CornerRadius" Value="2"></Setter>
        <Setter Property="BorderThickness" Value="1"></Setter>
        <Setter Property="BorderBrush" Value="#FF767676"></Setter>
        <Setter Property="Margin" Value="1"></Setter>
    </Style>
    
   
    
    <Style x:Key="ListGroupStyle"  TargetType="{x:Type GroupItem}">       
        <Setter Property="Template">
            <Setter.Value>
                <ControlTemplate TargetType="{x:Type GroupItem}">
                    <Expander x:Name="GroupExpander" Style="{StaticResource StatusGroupExpander}"
                              IsExpanded="{Binding Mode=OneTime, Path=ItemCount, Converter={StaticResource icec}, ConverterParameter=6}">
                        <Expander.Header>
                            <TextBlock FontWeight="Bold" Text="{Binding Path=Name, Mode=OneWay}"/> 
                        </Expander.Header>
                        <ItemsPresenter Visibility="{Binding ElementName=GroupExpander, Path=IsExpanded, Converter={StaticResource btvc}}" 
                                        x:Name="GroupItemPresenter" Margin="5,2,0,0">
                        </ItemsPresenter> 
                    </Expander>
                </ControlTemplate>
            </Setter.Value>
        </Setter>        
    </Style>

    <Style x:Key="ValidationTextBox"  TargetType="{x:Type TextBox}">
        <Setter Property="Validation.ErrorTemplate">
            <Setter.Value>
                <ControlTemplate>
                    <DockPanel LastChildFill="true">
                        <Image Source="/AutomationMLMapper;component/Images/AllAnnotations_Error.png" DockPanel.Dock="right" 
                                   Margin="-20,0,0,0" Width="16" Height="16" VerticalAlignment="Center"
                                   ToolTip="{Binding ElementName=customAdorner, Path=AdornedElement.(Validation.Errors)[0].ErrorContent}">
                        </Image>
                        <AdornedElementPlaceholder Name="customAdorner" VerticalAlignment="Center" >
                            <Border BorderBrush="red" BorderThickness="1" />
                        </AdornedElementPlaceholder>
                    </DockPanel>
                </ControlTemplate>
            </Setter.Value>
        </Setter>
    </Style>

    <Style x:Key="ValidationTextBlock"  TargetType="{x:Type TextBlock}">
        <Setter Property="Validation.ErrorTemplate">
            <Setter.Value>
                <ControlTemplate>
                    <DockPanel LastChildFill="true">
                        <Image Source="/AutomationMLMapper;component/Images/AllAnnotations_Error.png" DockPanel.Dock="right" 
                                   Margin="-20,0,0,0" Width="16" Height="16" VerticalAlignment="Center"
                                   ToolTip="{Binding ElementName=customAdorner, Path=AdornedElement.(Validation.Errors)[0].ErrorContent}">
                        </Image>
                        <AdornedElementPlaceholder Name="customAdorner" VerticalAlignment="Center" >
                            <Border BorderBrush="red" BorderThickness="1" />
                        </AdornedElementPlaceholder>
                    </DockPanel>
                </ControlTemplate>
            </Setter.Value>
        </Setter>
    </Style>

    <Style x:Key="HeaderTextBlock"  TargetType="{x:Type TextBlock}">
        <Setter Property="FontWeight" Value="DemiBold"></Setter>
        <Setter Property="Padding" Value="5"></Setter>
        <Setter Property="Background" Value="#FFEBEBEB"></Setter>
    </Style>

    <!--Width="{Binding RelativeSource={RelativeSource Mode=FindAncestor, AncestorType={x:Type Expander}}, Path=ActualWidth}"-->

    <DataTemplate x:Key="ExpanderHeader">
        <TextBlock 
            Background="#FFEBEBEB" FontWeight="DemiBold" Padding="5" Text="{Binding}">
        </TextBlock>
    </DataTemplate>
    
</ResourceDictionary>